import pymysql
# 定义变量，创建连接
conn = pymysql.connect(host="211.103.136.244", port=7068, user="student", password="KDTX_student_202304",
                       database="huike", charset="utf8")

# 定义变量，创建游标
cursor = conn.cursor()
try:
    sql = "delete from tb_course where name='小天才睿智手表666666666666'"
    sql2 = "delete from tb_contract where name='小天才睿智手表66666666666'"
    cursor.execute(sql)
    cursor.execute(sql2)
    print(cursor.fetchone())
    conn.commit()
except Exception as e:
    print(e)
    conn.rollback()
    print(cursor.fetchone())




# 关闭游标
cursor.close()
# 关闭数据库连接
conn.close()